<?php

class ApplicationModule extends Eloquent {
	protected $table;
	public $timestamps = false;
	
	/**
	 * ******************************************************************************
	 * ******************************* PUBLIC FUNCTIONS ******************************
	 * ******************************************************************************
	 */
	public function __construct() {
		$this->table = Helper::getDB ( 'core' ) . 'application_module';
		parent::__construct();
	}
	
	/**
	 * if the moduleName contains a '_', remove this character and write the first letter after this character in upper case
	 */
	public function getName(){
		$name = $this->name;
		$segments = explode('_', $name);
	
		$name = '';
		if (!empty($segments)){
			foreach($segments as $segment)
				$name .= ucfirst(strtolower($segment));
			$name = lcfirst($name);
		}
		return $name;
	}
	
	/**
	 * returns the name for ajax
	 * 
	 * @return string
	 */
	public function getAjaxName() {
		return str_replace ( '_', '/', $this->name );
	}
}